Skip to content

Dynamic RPC resolver#89

Open
arentant wants to merge 8 commits intomain-v2from
arentant/dynamic-rpc-resolver
Open

Dynamic RPC resolver#89
arentant wants to merge 8 commits intomain-v2from
arentant/dynamic-rpc-resolver

Conversation

@arentant
Copy link
Contributor

Summary

Implements network-aware RPC resolution with critical bug fixes for atomic swap polling and lock verification.

Three critical fixes:

  1. AtomicProvider now reactively subscribes to RPC config changes, ensuring polling uses fresh URLs when user changes custom RPCs
  2. HTLCClient.getSolverLockDetails restored cross-node agreement check to prevent false lock detection from stale/faulty RPCs
  3. TON client now respects custom network RPC URLs instead of using a hardcoded singleton

Dynamic RPC infrastructure:

  • NodeResolver: queries chainlist-rpcs for public RPC endpoints by chain type
  • Balance/gas providers updated to use getNetworkRpcUrl helpers
  • Viem transports built with fallback across multiple RPC URLs
  • Support for EVM (chainlist-rpcs) and non-EVM chains (curated endpoints)

🤖 Generated with Claude Code

1. AtomicProvider now reactively subscribes to rpcConfigStore so changing custom RPC URLs triggers a rerender and polling uses fresh URLs.

2. HTLCClient.getSolverLockDetails restored cross-node agreement check: queries all nodes in parallel and requires matching lock details before accepting, preventing false lock detection from stale/faulty nodes.

3. TON client now respects network-aware RPC configuration: createTonClient(network) is called by getTONDetails and commitTransactionBuilder instead of using a hardcoded singleton.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
trainapp-monorepo Ready Ready Preview, Comment Mar 13, 2026 3:14pm

Request Review

- Updated AtomicProvider to include destinationRedeemTx in the htlcStatus calculation for improved accuracy.
- Replaced NodeResolver class with a standalone resolveNodes function for better clarity and performance in resolving RPC nodes.
- Enhanced useSolverLockPolling to implement consensus verification across multiple nodes, ensuring consistent lock details are returned.
- Added validation for custom RPC URLs in the rpcConfigStore to prevent invalid URLs from being used.

These changes improve the reliability and maintainability of the RPC handling and polling mechanisms.
…ication in useSolverLockPolling

- Adjusted the timeout duration in AtomicProvider from 3 minutes to 2 minutes for manual claim requirements.
- Added useEffect in useSolverLockPolling to reset consensus verification state when hashlock changes, improving polling accuracy.

These changes enhance the responsiveness and reliability of the HTLC handling logic.
…tion effect

- Modified the useEffect in useSolverLockPolling to reset consensus verification state when both hashlock and nodeUrls change, improving the accuracy of polling behavior.

This change enhances the responsiveness of the HTLC handling logic by ensuring that the polling mechanism reacts to updates in node URLs.
@arentant arentant changed the title Dynamic RPC resolver with critical fixes Dynamic RPC resolver Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant